<?php

namespace JLPay\Models\Openmerch\Bill;

use JLPay\Models\BaseRequest;

/**
 * 结算账单查询请求
 * 
 * @author liaochangyi
 * @since 2025-01-25
 */
class SettleBillQueryRequest extends BaseRequest
{
    /**
     * API URL
     */
    public const API_URL = '/open/bill/settle-bill/query';

    protected ?string $merchNo = null;  // 商户号
    protected ?string $startBusiDate = null;  // 开始营业日期，订单交易日期（订单交易日期/订单清算日期，二选一），结束时间减开始时间不能超过30天， yyyy-MM-dd
    protected ?string $endBusiDate = null;  // 结束营业日期，订单交易日期（订单交易日期/订单清算日期，二选一），结束时间减开始时间不能超过30天， yyyy-MM-dd
    protected ?string $startSettleDate = null;  // 开始结算日期，订单结算日期（订单交易日期/订单清算日期，二选一）， yyyy-MM-dd
    protected ?string $endSettleDate = null;  // 结束结算日期，订单结算日期（订单交易日期/订单清算日期，二选一）， yyyy-MM-dd
    protected ?string $payStatus = null;  // 付款状态，0-待付款 1-付款成功 2-付款失败 3-无需付款

    /**
     * 设置商户号
     *
     * @param string $merchNo
     * @return self
     */
    public function setMerchNo(string $merchNo): self
    {
        $this->merchNo = $merchNo;
        return $this;
    }

    /**
     * 设置开始营业日期
     *
     * @param string $startBusiDate
     * @return self
     */
    public function setStartBusiDate(string $startBusiDate): self
    {
        $this->startBusiDate = $startBusiDate;
        return $this;
    }

    /**
     * 设置结束营业日期
     *
     * @param string $endBusiDate
     * @return self
     */
    public function setEndBusiDate(string $endBusiDate): self
    {
        $this->endBusiDate = $endBusiDate;
        return $this;
    }

    /**
     * 设置开始结算日期
     *
     * @param string $startSettleDate
     * @return self
     */
    public function setStartSettleDate(string $startSettleDate): self
    {
        $this->startSettleDate = $startSettleDate;
        return $this;
    }

    /**
     * 设置结束结算日期
     *
     * @param string $endSettleDate
     * @return self
     */
    public function setEndSettleDate(string $endSettleDate): self
    {
        $this->endSettleDate = $endSettleDate;
        return $this;
    }

    /**
     * 设置付款状态
     *
     * @param string $payStatus
     * @return self
     */
    public function setPayStatus(string $payStatus): self
    {
        $this->payStatus = $payStatus;
        return $this;
    }

    /**
     * 获取商户号
     *
     * @return string|null
     */
    public function getMerchNo(): ?string
    {
        return $this->merchNo;
    }

    /**
     * 转换为数组
     *
     * @return array
     */
    public function toArray(): array
    {
        $data = parent::toArray();
        $data['merch_no'] = $this->merchNo;
        $data['start_busi_date'] = $this->startBusiDate;
        $data['end_busi_date'] = $this->endBusiDate;
        $data['start_settle_date'] = $this->startSettleDate;
        $data['end_settle_date'] = $this->endSettleDate;
        $data['pay_status'] = $this->payStatus;
        return $data;
    }
} 